﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNCDataSetTableAdapters;
using System.Data;

public partial class UserControl_content_detail_product : System.Web.UI.UserControl
{
    ProductsTableAdapter pro = new ProductsTableAdapter();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadDetaiProduct();
        }

    }

    public void loadDetaiProduct()
    {
        int ProductID = int.Parse(HttpContext.Current.Request.RequestContext.RouteData.Values["ProductID"].ToString());
        DataTable dt = pro.GetProductByProductID(ProductID);
        lblTitle.Text = FuntionHNC.GetLanguage(dt.Rows[0]["Title"].ToString(), dt.Rows[0]["Title_en"].ToString());

        int price = int.Parse(dt.Rows[0]["Price"].ToString());
        if (price > 0)
        {
            lblPrice.Text = price + " VNĐ";
        }
        else
        {
            lblPrice.Text = FuntionHNC.GetLanguage("Liên hệ","Contact Us"); 
        }

        imgImage.Src = "~/UserUploads/Product/" + dt.Rows[0]["Image"].ToString();
        ltrContent.Text = FuntionHNC.GetLanguage(dt.Rows[0]["Content"].ToString(), dt.Rows[0]["Content_en"].ToString());
    }
    // public string loadvideo()
    //{
    //int ProductID = int.Parse(HttpContext.Current.Request.RequestContext.RouteData.Values["ProductID"].ToString());

    //string tem = "";
    //DataTable dt = pro.GetProductByProductID(ProductID);
    //string VideoUrl = dt.Rows[0]["VideoUrl"].ToString();
    //lblTitle.Text = dt.Rows[0]["Title"].ToString();
    //tem += "'<iframe width=\"640\" height=\"480\" src=\"//www.youtube-nocookie.com/embed/" + VideoUrl + "\" frameborder=\"0\" allowfullscreen></iframe>";
    //return tem;
    //  }
}